package com.hsmpay.mobile.dao.trans.impl;

import com.hsmpay.common.dao.Impl.BaseDaoSupport;
import com.hsmpay.mobile.dao.trans.TransRefuseCardDao;
import com.hsmpay.mobile.pojo.trans.TransRefuseCard;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;

/**
 * 拒绝交易卡号 sqlmap 接口 transRefuseCardDao
 * 对应pojo TransRefuseCard
 *
 * @author 颜铃璋
 *         创建时间：2013-11-22
 */
@Repository("transRefuseCardDao")
public class TransRefuseCardDaoImpl extends BaseDaoSupport<TransRefuseCard, Long> implements TransRefuseCardDao<TransRefuseCard, Long> {
    /**
     * 查询前缀
     *
     * @param currentBankcard 当前交易卡号
     * @return
     * @throws SQLException
     */
    public int queryPrefixCount(String currentBankcard) throws SQLException {
        TransRefuseCard trc = new TransRefuseCard();
        trc.setCurrentBankcard(currentBankcard);
        trc.setType(1);//前缀
        return (Integer) getIbatisTemplate().queryForObject("transRefuseCardSqlMap.queryPrefixCount", trc);
    }

    /**
     * 查询后缀
     *
     * @param currentBankcard 当前交易卡号
     * @return
     * @throws SQLException
     */
    public int querySuffixCount(String currentBankcard) throws SQLException {
        TransRefuseCard trc = new TransRefuseCard();
        trc.setCurrentBankcard(currentBankcard);
        trc.setType(2);//后缀
        trc.setCurrentBCLen(currentBankcard.length());
        return (Integer) getIbatisTemplate().queryForObject("transRefuseCardSqlMap.querySuffixCount", trc);
    }
}
